************************************************************************************************************************
* Replication Do-File for Nooruddin, Irfan, and Joel W. Simmons. 2009. 
* "Openness, Uncertainty, and Social Spending: Implications for the 
* Globalization-Welfare State Debate." International Studies Quarterly 
* 53 (3): 841-866.
************************************************************************************************************************

***** PRELIMINARIES
** SET THE DATA FOR TIME-SERIES CROSS-SECTION ANALYSIS
tsset ctryid year
** GENERATE COUNTRY FIXED EFFECTS
tab ctryname, gen(f)

***********************************************
** REPLICATING TABLES IN THE ARTICLE          *
***********************************************

***** TABLE 1, page 857: SUMMARY STATISTICS
summ educ_change educ welf_change welf d.importgdp importgdp d.exportgdp exportgdp d.trade trade d.polity_dummy polity_dummy /*
*/ d.pol3 pol3 d.polity2 polity2 d.lngdpcap lngdpcap d.depend_ratio depend_ratio d.currentacct_gdp currentacct_gdp /*
*/ d.log_debttotal log_debttotal if oecd==0
***** TABLE 2, PAGE 858: EFFECT OF INCREASING OPENNESS ON WELFARE AND EDUCATION SPENDING*** MODEL 1xi3:  xtpcse welf_change importld*importlag*dumlag welflag  welfld  lngdpcapld lngdpcaplag dependld dependlag dumld exportlag exportld /**/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, paestimates store welf_econcontrols** MODEL 2xi3:  xtpcse educ_change importld*importlag*dumlag educlag educld lngdpcapld lngdpcaplag dependld dependlag dumld exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld   year f1-f215 if oecd==0, pa
estimates store educ_econcontrols

***** TABLE 3, PAGE 862: SENSITIVITY ANALYSIS
** MODEL 3
xi3:  xtpcse welf_change importld*importlag*dumlag welflag welfld  lngdpcapld lngdpcaplag year f1-f215 if oecd==0, pa
estimates store weflg2_sens1
** MODEL 4
xi3:  xtpcse welf_change importld*importlag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ year f1-f215 if oecd==0, pa
estimates store weflg2_sens2
** MODEL 5
xi3:  xtpcse welf_change importld*importlag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  year f1-f215 if oecd==0, pa
estimates store weflg2_sens3
** MODEL 6
xi3:  xtpcse welf_change importld*importlag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store weflg2_sens4
** MODEL 7
xi3:  xtpcse welf_change importld*importlag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld exportld exportlag year f1-f215 if oecd==0, pa


***********************************************
** OTHER ANALYSES REFERENCED IN THE TEXT      *
***********************************************

****** FOOTNOTE 17, PAGE 853: USING HEALTH CARE SPENDING AS DV
xi3:  xtpcse health_change importld*importlag*dumlag healthlag  healthld lngdpcapld lngdpcaplag dependld dependlag dumld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld exportlag exportld year f1-f215 if oecd==0, pa
estimates store base_health

****** FOOTNOTE 19, PAGE 854: MEASURING SPENDING AS SHARE OF GDP
xi3:  xtpcse welfgdp_change importld*importlag*dumlag welfgdplag  welfgdpld lngdpcapld lngdpcaplag dependld dependlag dumld exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store base_welf

xi3:  xtpcse educgdp_change importld*importlag*dumlag educgdplag  educgdpld lngdpcapld lngdpcaplag dependld dependlag dumld exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store base_educgdp 

****** FOOTNOTE 21, PAGE 855: TOTAL TRADE AND EXPORTS INSTEAD OF IMPORTS******
xi3:  xtpcse educ_change tradeld*tradelag*dumlag educlag educld lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store educ_trade_dum

xi3:  xtpcse welf_change tradeld*tradelag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store welf_trade_dum

xi3:  xtpcse educ_change exportld*exportlag*dumlag educlag educld lngdpcapld lngdpcaplag dependld dependlag importld importlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store educ_export_dum

xi3:  xtpcse welf_change exportld*exportlag*dumlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag importld importlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store welf_export_dum

****** FOOTNOTE 22, PAGE 856: SPLIT SAMPLE MODELS INSTEAD OF TRIPLE INTERACTIONS

xi3:  xtpcse welf_change importld*importlag welflag welfld  lngdpcapld lngdpcaplag dependld dependlag exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0&polity_dummy==1, pa
estimates store welf_dems

xi3:  xtpcse welf_change importld*importlag welflag welfld lngdpcapld lngdpcaplag dependld dependlag exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0&polity_dummy==0, pa
estimates store welf_nondems

xi3:  xtpcse educ_change importld*importlag educlag educld lngdpcapld lngdpcaplag dependld dependlag exportlag exportld year /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld f1-f215 if oecd==0&polity_dummy==1, pa
estimates store educ_dems

xi3:  xtpcse educ_change importld*importlag educlag educld lngdpcapld lngdpcaplag dependld dependlag exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0&polity_dummy==0, pa
estimates store educ_nondems

****** PAGE 861: SENSITIVITY ANALYSIS FOR EDUCATION MODELS******

xi3:  xtpcse educ_change importld*importlag*dumlag educlag educ2ld  lngdpcapld lngdpcaplag year f1-f215 if oecd==0, pa
estimates store educ_sens1

xi3:  xtpcse educ_change importld*importlag*dumlag educlag educ2ld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ year f1-f215 if oecd==0, pa
estimates store educ_sens2

xi3:  xtpcse educ_change importld*importlag*dumlag educlag educ2ld lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  year f1-f215 if oecd==0, pa
estimates store educ_sens3

xi3:  xtpcse educ_change importld*importlag*dumlag educlag educ2ld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store educ_sens4

xi3:  xtpcse educ_change importld*importlag*dumlag weduclag educ2ld  lngdpcapld lngdpcaplag dependld dependlag dumld  /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld exportld exportlag year f1-f215 if oecd==0, pa


****** FOOTNOTES 29 AND 30, PAGE 861: ALTERNATIVE DEMOCRACY MEASURES*********Using trichotomous democracy coding***xi3:  xtpcse welf_change importld*importlag*pol3lag welflag welfld lngdpcapld lngdpcaplag dependld dependlag pol3ld exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store welf_pol3xi3:  xtpcse educ_change importld*importlag*pol3lag educlag educld lngdpcapld lngdpcaplag dependld dependlag pol3ld exportlag exportld /**/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, paestimates store educ_pol3***Using continuous democracy coding***xi3:  xtpcse welf_change importld*importlag*pollag welflag welfld lngdpcapld lngdpcaplag dependld dependlag polld exportlag exportld /*
*/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, pa
estimates store welf_polity2xi3:  xtpcse educ_change importld*importlag*pollag educlag educld lngdpcapld lngdpcaplag dependld dependlag polld exportlag exportld /**/ currentacct_gdplag currentacct_gdpld  log_debttotallag log_debttotalld year f1-f215 if oecd==0, paestimates store educ_polity2
